home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Turnbull China Bikeride
/
Turnbull China Bikeride - Disc 2.iso
/
STUTTGART
/
LANG
/
C
/
LIB
/
UNIXLIB37B
/
!UnixLib37
/
src
/
clib
/
unixlib
/
h
/
sigstate
next >
Wrap
Text File
|
1996-11-09
|
6KB
|
176 lines
/****************************************************************************
*
* $Source: /unixb/home/unixlib/source/unixlib37/src/clib/unixlib/h/RCS/sigstate,v $
* $Date: 1996/10/30 21:57:16 $
* $Revision: 1.1 $
* $State: Rel $
* $Author: unixlib $
*
* $Log: sigstate,v $
* Revision 1.1 1996/10/30 21:57:16 unixlib
* Initial revision
*
***************************************************************************/
/* This is an internal UnixLib header file for implementing the signal
handlers. This functions cannot be used in a user program. */
#ifndef __UNIXLIB_SIGSTATE_H
#define __UNIXLIB_SIGSTATE_H 1
#ifndef __STDDEF_H
#include <stddef.h>
#endif
#ifndef __SIGNAL_H
#include <signal.h>
#endif
#ifndef __ERRNO_H
#include <errno.h>
#endif
/* Signal state for each thread. */
struct unixlib_sigstate
{
/* The blocked signals for this process. */
sigset_t blocked;
/* The pending signals for this process. */
sigset_t pending;
/* The defined signal handlers for this process. */
struct sigaction actions[NSIG];
struct sigaltstack signalstack;
struct
{
/* For each signal that may be pending, the
sigcode and error code to deliver it with. */
int code, error;
} pending_data[NSIG];
/* If `suspended' is set when this process gets a signal,
the signal thread sends an empty message to it. */
int suspended;
/* If 'currently_handling' is set, then the process is currently
executing a signal handler. Any raised signals will be pended and
executed after the current signal has finished executing. */
int currently_handling;
};
/* Initialize the signal code. */
extern void __unixlib_sig_init (void);
/* Raise a signal as described by SIGNO, SIGCODE and SIGERROR, on the
process whose sigstate SS points to. If SS is a null pointer, this
instead affects the calling process. */
extern void __unixlib_raise_signal (struct unixlib_sigstate *ss,
int signo, int sigcode, int sigerror);
/* Make the thread described by SS take the signal described by signo
and sigcode. */
extern void __unixlib_internal_post_signal (struct unixlib_sigstate *ss,
int signo, int sigcode, int error);
/* Set up SS to handle signal SIGNO by running HANDLER.
The handler is passed SIGNO and SIGCODE. */
extern int __unixlib_setup_sighandler (struct unixlib_sigstate *ss,
__sighandler_t handler, int signo, int sigcode, int flags);
/* Function run for SIGINFO when its action is SIG_DFL and the current
process is the session leader. */
extern void __unixlib_siginfo_handler (int);
/* Reserved for internal use by Unixlib. Preemptive signals can
be used to intercept a signal and handle it in a successful manner
which would then prevent an unnecessary signal being delivered. */
struct unixlib_signal_preempt
{
/* The handler is called even for blocked signals. This function is
run in the sigal thread and should be as simple and robust as possible.
signo and sigcode would be passed to the normal handler.
If the return value is SIG_DFL, normal signal processing continues.
If it is SIG_IGN, the signal is ignored.
Any other value is used in place of the normal handler. */
sighandler_t (*handler) (int thread, int signo, int sigcode);
int first, last; /* Range of sigcodes this handler wants. */
struct unixlib_signal_preempt *next; /* Next handler on the chain. */
};
/* Pre-emptive signal handling. Internal use only. */
extern int unixlib_preempt_signals (struct unixlib_signal_preempt *preempter,
int signo, int first_code, int last_code,
sighandler_t (*handler) (int, int, int));
extern int unixlib_unpreempt_signals (struct unixlib_signal_preempt *preempter,
int signo);
/* Initialise all the signals. */
extern void __unixlib_internal_signame_init (void);
/* Actual signal execution functions. Depends on whether we are
using sigstack, sigaltstack or not. */
extern void __unixlib_exec_sig (__sighandler_t, int);
extern void __unixlib_exec_sigstack_bsd (void *sp, __sighandler_t, int);
extern void __unixlib_exec_sigstack (void *sp, size_t size, __sighandler_t, int);
extern void __unixlib_default_sigaction (struct unixlib_sigstate *);
/* Writes a friendly error message depending on whether the signal
produces a core dump or just terminates. */
extern int __write_corefile (int signo, int sigcode, int sigerror);
extern void __write_termination (int signo, int sigcode, int sigerror);
/* Signal handler support functions. */
extern void __h_sigill(void); /* undefined instruction handler */
extern void __h_sigbus(void); /* address exception handler */
extern void __h_sigsegv0(void); /* prefetch abort handler */
extern void __h_sigsegv1(void); /* data abort handler */
extern void __h_sigfpe(void); /* FPE handler */
extern void __h_error(void); /* error handler */
extern void __h_sigint(void); /* escape handler */
extern void __h_event(void); /* event handler */
extern void __h_sigsys(void); /* unused SWI handler */
/* SIGALRM handler */
extern void __h_sigalrm(void);
extern void __h_sigalrm_init(void);
/* SIGVTALRM handler */
extern void __h_sigvtalrm(void);
extern void __h_sigvtalrm_init(void);
/* SIGPROF handler */
extern void __h_sigprof(void);
extern void __h_sigprof_init(void);
extern void __h_cback(void); /* CallBack handler */
extern void __h_exit(void); /* exit handler - calls _exit() */
extern unsigned int __cbreg[16]; /* callback handler register buffer */
extern char *__h_errbuf; /* error handler string buffer */
/* alarm semaphores */
extern int __h_sigprof_sema, __h_sigvtalrm_sema, __h_sigalrm_sema;
/* Wake a process up from sleeping. */
extern void sigwakeup (void);
/* Details for stack backtraces and core dumps. */
/* Generate a stack backtrace, fp is the value of the
current frame pointer. */
extern void __backtrace (unsigned int *fp);
/* Generate a core dump, from the current fp. */
extern void __core (void);
#endif /* unixlib/signal.h */